- 
          
- 
                Notifications
    You must be signed in to change notification settings 
- Fork 33.3k
gh-73487: Convert _decimal to use Argument Clinic (part 4) #137931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
                
     Merged
            
            
          Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    eedb68d    to
    9afbcfb      
    Compare
  
    0c6f7f7    to
    8bb963f      
    Compare
  
    Co-authored-by: Serhiy Storchaka <[email protected]>
bae6e79    to
    b778703      
    Compare
  
    
      
        
              This comment was marked as outdated.
        
        
      
    
  This comment was marked as outdated.
| Docstrings diff: --- ref.txt 2025-08-20 12:30:34.001295564 +0300
+++ patch.txt   2025-08-20 12:29:57.118168737 +0300
@@ -108,13 +108,16 @@
      |  Methods defined here:
      |
      |  Etiny(self, /)
-     |      Return a value equal to Emin - prec + 1, which is the minimum exponent value
-     |      for subnormal results.  When underflow occurs, the exponent is set to Etiny.
+     |      Return a value equal to Emin - prec + 1.
+     |
+     |      This is the minimum exponent value for subnormal results.  When
+     |      underflow occurs, the exponent is set to Etiny.
      |
      |  Etop(self, /)
-     |      Return a value equal to Emax - prec + 1.  This is the maximum exponent
-     |      if the _clamp field of the context is set to 1 (IEEE clamp mode).  Etop()
-     |      must not be negative.
+     |      Return a value equal to Emax - prec + 1.
+     |
+     |      This is the maximum exponent if the _clamp field of the context is set
+     |      to 1 (IEEE clamp mode).  Etop() must not be negative.
      |
      |  __copy__(self, /)
      |
@@ -437,10 +440,12 @@
     class Decimal(builtins.object)
      |  Decimal(value='0', context=None)
      |
-     |  Construct a new Decimal object. 'value' can be an integer, string, tuple,
-     |  or another Decimal object. If no value is given, return Decimal('0'). The
-     |  context does not affect the conversion and is only passed to determine if
-     |  the InvalidOperation trap is active.
+     |  Construct a new Decimal object.
+     |
+     |  value can be an integer, string, tuple, or another Decimal object.  If
+     |  no value is given, return Decimal('0'). The context does not affect
+     |  the conversion and is only passed to determine if the InvalidOperation
+     |  trap is active.
      |
      |  Methods defined here:
      |
@@ -454,12 +459,14 @@
      |      True if self else False
      |
      |  __ceil__(self, /)
+     |      Return the ceiling as an Integral.
      |
      |  __complex__(self, /)
+     |      Convert this value to exact type complex.
      |
      |  __copy__(self, /)
      |
-     |  __deepcopy__(self, object, /)
+     |  __deepcopy__(self, memo, /)
      |
      |  __divmod__(self, value, /)
      |      Return divmod(self, value).
@@ -471,6 +478,7 @@
      |      float(self)
      |
      |  __floor__(self, /)
+     |      Return the floor as an Integral.
      |
      |  __floordiv__(self, value, /)
      |      Return self//value.
@@ -524,7 +532,7 @@
      |      Return divmod(value, self).
      |
      |  __reduce__(self, /)
-     |      Helper for pickle.
+     |      Return state information for pickling.
      |
      |  __repr__(self, /)
      |      Return repr(self).
@@ -538,7 +546,8 @@
      |  __rmul__(self, value, /)
      |      Return value*self.
      |
-     |  __round__(...)
+     |  __round__(self, ndigits=<unrepresentable>, /)
+     |      Return the Integral closest to self, rounding half toward even.
      |
      |  __rpow__(self, value, mod=None, /)
      |      Return pow(value, self, mod).
@@ -550,7 +559,7 @@
      |      Return value/self.
      |
      |  __sizeof__(self, /)
-     |      Size of object in memory, in bytes.
+     |      Returns size in memory, in bytes
      |
      |  __str__(self, /)
      |      Return str(self).
@@ -562,6 +571,7 @@
      |      Return self/value.
      |
      |  __trunc__(self, /)
+     |      Return the Integral closest to x between 0 and x.
      |
      |  adjusted(self, /)
      |      Return the adjusted exponent (exp + digits - 1) of the number. | 
              
                    serhiy-storchaka
  
              
              approved these changes
              
                  
                    Aug 20, 2025 
                  
              
              
            
            
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍
              
                    AA-Turner
  
              
              approved these changes
              
                  
                    Aug 20, 2025 
                  
              
              
            
            
| Thanks! A | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.